﻿#include "im3d_conversion.h"
#include <iostream>

int main() {
    // 配置参数
    std::string model_path = "openvino_models";
    bool use_bf16 = false;
    int width = 480;
    int height = 540;
    float x_shift = 0.014f;

    // 创建转换器
    IM3DConversion converter(model_path, use_bf16, width, height, x_shift);

    // 初始化
    if (!converter.initialize()) {
        std::cerr << "Failed to initialize IM3DConversion" << std::endl;
        return -1;
    }

    // 读取输入图像
    std::string input_name = "input_frame.jpg";
    std::cout << "load input frame " << input_name <<std::endl;

    cv::Mat input_frame = cv::imread(input_name);
    if (input_frame.empty()) {
        std::cerr << "Failed to load input image" << std::endl;
        return -1;
    }

    std::cout << "success load frame " << input_name << std::endl;

    // 处理帧
    std::cout << "process frame" << std::endl;
    cv::Mat output_frame = converter.processFrame(input_frame);

    if (!output_frame.empty()) {
        cv::imwrite("output.jpg", output_frame);
        std::cout << "Processing completed successfully" << std::endl;
    }
    else {
        std::cerr << "Processing failed" << std::endl;
        return -1;
    }

    return 0;
}